<template>
  <div class="flex p-[10px] gap-4 flex-wrap">
    <ComponentItem description="按钮" :name="ItemType.Button" @DragEnd="handlerDragEnd" />
  </div>
</template>

<script setup name="EditorMaterial">
import { useEditorCodeStore } from '../store/index'
import ComponentItem from '../Components/ComponentItem.vue'
import { ItemType } from '../config/index'

const editorCodeStore = useEditorCodeStore()

const handlerDragEnd = (result) => {
  console.log('result', result)

  editorCodeStore.addComponent({
    id: new Date().getTime(),
    name: result.name,
    props: result.props
  })

  console.log(editorCodeStore.componentList)
}
</script>
